package com.woniu113.junk.user.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;

@Configuration
public class RabbitMQConfig {
    /**
     * 创建一个队列*/
    @Bean
    public Queue registerPhoneQueue(){
        return new Queue("register_phone_queue");
    }
    @Bean
    public Queue userLoginPhoneQueue(){
        return new Queue("user_login_phone_queue");
    }
    @Bean
    public Queue AdminLoginPhoneQueue(){
        return new Queue("admin_login_phone_queue");
    }
    @Bean
    public Queue userUpPhoneQueue(){
        return new Queue("user_up_phone_queue");
    }
    /***
     *延迟队列
     */
    @Bean
    public Queue checkOrderExpire(){
        HashMap<String,Object> map = new HashMap<>();
        map.put("x-message-ttl",1*60*1000);
        map.put("x-dead-letter-exchange","check_order_exchange");
        map.put("x-dead-letter-routing-key","check");
        return new Queue("check_order_expire_queue",true,false,false,map);
    }

}
